# -*- coding: iso-8859-15 -*-

import Pyro.core
import Pyro.naming
import RemoteCode


def main():
    Pyro.config.PYRO_MOBILE_CODE = 1
    Pyro.core.initClient(banner=1)

    locator = Pyro.naming.NameServerLocator()
    ns = locator.getNS()

    uri = ns.resolve('networkFactory')

    networkFactory = Pyro.core.getProxyForURI(uri)
    
    network = networkFactory.create()
    nodes = nodesnetwork = network.createNodes(10)
    network.setTopology('ring') 
    nodesnetwork[0].test() // this method work as it should when invoked here
    
    initValueHolderObj = RemoteCode.initValueHolder()
    estimateHolderObj = RemoteCode.estimateHolder()
    functorObj = RemoteCode.functorClass()
    initializeNodeObj = RemoteCode.initializeNodeClass()

    '''
    network.setInitObjects(initValueHolderObj, estimateHolderObj, functorObj, initializeNodeObj)
    '''
    network.setCommModel('_syncBroadcastModel')
    nodes[1].compute()
    
    
    
if __name__ =="__main__":
	main()
